package de.fme.tracking;

import java.util.Date;
import java.util.List;

/**
* @author jploetz
* @since 4.0b
*/
public interface FeedbackDAO
{
	/*
	 * FEEDBACK ENTRY METHODS **************************************************************************************************************
	 */
	
	/**
	 * CREATE FEEDBACK ENTRY
	 * creates a feedback entry in the database
	 * @param feedback of type FeedbackEntity
	 * @return database entry feedback ID
	 */
	int createFeedbackEntry(FeedbackEntity feedback);
	
	/**
	 * FEEDBACK by ID => ONE PARTICULAR FEEDBACK ENTRY
	 * requests FeedbackEntity from database by feedback entry ID 
	 * @param feedbackId
	 * @return FeedbackEntity feedback
	 */
	FeedbackEntity getFeedbackEntry(Long feedbackId);
   
	/**
	 * FEEDBACK by CHANNEL => ALL THE FEEDBACK FOR ALL PUBLISHED ASSETS FROM ONE CHANNEL
	 * requests a set of FeedbackEntities from database by publishing channel UUID 
	 * @param String channelUuid
	 * @return List<FeedbackEntity> feedback
	 */
	List<FeedbackEntity> getFeedbackByChannelNode(String channelUuid); // Channel properties.....toString()
   
	/**
	 * FEEDBACK by PUBLISHINGEVENT => ALL THE FEEDBACK FOR ONE PUBLISHED ASSET
	 * requests a set of FeedbackEntities from database by publishing Event UUID 
	 * @param String pubEventUuid
	 * @return List<FeedbackEntity> feedback
	 */
	List<FeedbackEntity> getFeedbackByPubEventNode(String pubEventUuid);
   
	/**
	 * FEEDBACK by USER => ALL THE FEEDBACK GIVEN BY A SINGLE USER FOR ANY PUBLISHED ASSET
	 * requests a set of FeedbackEntities from database by user Entry ID 
	 * @param String userID
	 * @return List<FeedbackEntity> feedback
	 */
	List<FeedbackEntity> getFeedbackByUserId(long userID); // UserEntity user.getId();
   
   /**
    * FEEDBACK by DATE => ALL THE FEEDBACK GIVEN BY A SINGLE USER FOR ANY PUBLISHED ASSET
	* requests a set of FeedbackEntities from database by user Entry ID 
    * Because you don't always want to search the whole database
    * @return
    */
	List<FeedbackEntity> getAllFeedbackEntriesFrom(Date fetchDate);
   
	/**
	 * DELETE FEEDBACK BY ENTRY ID
	 * @param feedbackEntryId
	 * @return int number of deleted entries
	 */
	int deleteFeedbackEntries(Long feedbackEntryId);
	
	/*
	 * USER ENTRY METHODS **************************************************************************************************************
	 */
	
	/**
	 * CREATE USER ENTRY
	 * creates a user entry in the database
	 * @param user of type UserEntity
	 * @return database entry user ID
	 */
	int createUserEntry(UserEntity user);
	
	/**
	 * USER by ID => ONE PARTICULAR USER ENTRY
	 * requests UserEntity from database by user entry ID
	 * @param userId
	 * @return UserEntity user
	 */
	UserEntity getUserById(long userId);
   
	/**
	 * USER by FEEDBACK ID => ONE PARTICULAR USER ENTRY BY FEEDBACK ID
	 * requests UserEntity from database by FEEDBACK entry ID
	 * @param userId
	 * @return UserEntity user
	 */
	UserEntity getUserByFeedbackId(long feedbackId); // lookup user ID in feedbackEntry and call getUserById()
   
	/**
	 * DELETE USER BY ENTRY ID
	 * @param userId
	 * @return int number of deleted entries
	 */
	int deleteUserById(Long userId);
   
	/**
	 * DELETE USERs BY LIST OF USER ENTRY IDs
	 * @param userEntryIds
	 * @return int number of deleted entries
	 */
	int deleteUsersByUserIds(List<Long> userEntryIds);
	
	/**
	 * DELETE USERs BY LIST OF FEEDBACK ENTRY IDs
	 * @param feedbackEntryIds
	 * @return int number of deleted entries
	 */
	int deleteUsersByFeedbackIds(List<Long> feedbackEntryIds); // lookup user ID in feedbackEntry and call DELETEUserSByUSERIdS()
	
	
	/*
	 * USER ENTRY METHODS **************************************************************************************************************
	 */
	
	/**
	 * CREATE FEEDBACKTYPE ENTRY
	 * creates a type entry in the database
	 * @param type of type TypeEntity
	 * @return database entry type ID
	 */
	int createFeedbackTypeEntry(TypeEntity type);
	
	/**
	 * DELETE FEEDBACKTYPE ENTRY
	 * deletes a type entry in the database
	 * @param type of type TypeEntity
	 * @return int number of deleted entries
	 */
	int deleteFeedbackTypeEntry(TypeEntity type);
}